<template>
	<view class="content">
		<image mode="widthFix" style="width: 100%;" :src="imageUrl+'/dingxi-jobs/login/top.png'" class="bg-img"></image>
		<view class="welcome-box">
			<view class="welcome-text">欢迎进入</view>
			<view class="welcome-text">定西人力资源服务平台</view>
		</view>
		<view @click="jumpEnter(2)" class="entrance">
			<view class="entrance-text">
				<view class="sub">
					<view class="sub-text">企业身份</view>
					<image :src="imageUrl+'/dingxi-jobs/login/更多.png'" mode="widthFix" class="sub-btn"></image>
				</view>
				<view class="entrance-btn">岗位发布者入口</view>
			</view>
			<image mode="widthFix" style="width: 38%;" :src="imageUrl+'/job_hunting/index/enterprise_entrance.png'"
				class="icon"></image>
		</view>
		<view @click="jumpEnter(1)" class="entrance">
			<view class="entrance-text">
				<view class="sub">
					<view class="sub-text">个人身份</view>
					<image :src="imageUrl+'/dingxi-jobs/login/更多.png'" mode="widthFix" class="sub-btn"></image>
				</view>
				<view class="entrance-btn">就业推荐和我要求职</view>
			</view>

			<image mode="widthFix" style="width: 40%;" :src="imageUrl+'/job_hunting/index/jobs_entrance.png'"
				class="icon">
			</image>
		</view>
		<view @click="jumpEnter(3)" class="entrance">
			<view class="entrance-text">
				<view class="sub">
					<view class="sub-text">职介组织</view>
					<image :src="imageUrl+'/dingxi-jobs/login/更多.png'" mode="widthFix" class="sub-btn"></image>
				</view>
				<view class="entrance-btn">招聘者和内推者入口</view>
			</view>
		
			<image mode="widthFix" style="width: 40%;" :src="imageUrl+'/job_hunting/index/enterprise_entrance.png'"
				class="icon">
			</image>
		</view>
	</view>
</template>

<script>
	import {
		isLogin
	} from '@/util/user.js'
	export default {
		data() {
			return {
				imageUrl: ''
			}
		},
		methods: {
			jumpEnter(identity) {
				this.$store.commit('user/SET_IDENTITY', identity)
				uni.switchTab({
					url: '/pages/home/index'
				})
			}
		},
		onLoad(e) {
			if (e.id) {
				this.jumpEnter(e.id)
			}
			let identity
			this.imageUrl = this.globalConfig.imageUrl;
			if (isLogin()) { //如果已经登录则跳转至首页
				uni.switchTab({
					url: '/pages/home/index'
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: #FAFAFA;
	}

	.content .bg-img {
		width: 100%;
		position: absolute;
		top: 0;
	}

	.content .welcome-box {
		width: 85%;
		padding: 30rpx 0 0 7.5%;
		position: relative;

		.welcome-text {
			font-size: 36rpx;
			color: #fff;
			padding: 10rpx 0;
		}
	}

	.content .entrance {
		width: 85%;
		//height: calc(50vh - 80rpx);
		height: 300rpx;
		margin: 50rpx auto;
		background-color: #fff;
		border-radius: 36rpx;
		box-shadow: 0px 0px 4px #ccc;
		overflow: hidden;
		display: flex;
		flex-direction: row;
		justify-content: space-around;
		align-items: center;
		position: relative;

		.entrance-text {
			display: flex;
			flex-direction: column;

			.sub {
				display: flex;
				flex-direction: row;
				align-items: center;

				.sub-text {
					font-size: 42rpx;
					margin-right: 24rpx;
					font-weight: bold;
				}

				.sub-btn {
					width: 44rpx;
				}
			}

			.entrance-btn {
				font-size: 30rpx;
				font-weight: 400;
				color: #999999;
				margin-top: 20rpx;
			}
		}
	}
</style>